#!/bin/bash

ltoh='0 pwl 10n 0 10.03n 0.07 10.1n 0.711 10.23n 1.5 10.28n 1.68 10.3n 1.72 10.31n 1.73 10.43n 1.8'
htol='0 pwl 10n 1.8 10.025n 1.78 10.05n 1.64 10.11n 0.997 10.15n 0.357 10.17n 0.16 10.19n 0.062 10.23n 0'
high='0 dc 1.8'

rm -rf adder_low_to_high.txt adder_high_to_low.txt

# Generate low to High file (A: 1.8, B: 0 to 1.8, Cin: 1.8 to 0)

echo "vDD  vdd! 0 dc 1.8" >> adder_low_to_high.txt
echo "vGND gnd! 0 dc 0"   >> adder_low_to_high.txt

for (( i=0; i <= 31; ++i ))
do
  echo "vA$i A<$i> $htol" >> adder_low_to_high.txt
  echo "vB$i B<$i> $ltoh" >> adder_low_to_high.txt
done

echo "vC c_in $htol" >> adder_low_to_high.txt

# Generate high to low file (A: 0 to 1.8, B: 1.8 to 0, Cin: 1.8)

echo "vDD  vdd! 0 dc 1.8" >> adder_high_to_low.txt
echo "vGND gnd! 0 dc 0"   >> adder_high_to_low.txt

for (( i=0; i <=31; ++i ))
do
  echo "vA$i A<$i> $ltoh" >> adder_high_to_low.txt
  echo "vB$i B<$i> $htol" >> adder_high_to_low.txt
done

echo "vC c_in $ltoh" >> adder_high_to_low.txt
